package com.travel.model.dto.post;

import com.travel.model.dto.user.SimpleUserDTO;
import com.travel.model.entity.content.Comment;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.util.List;
//文章dto 文章id 文章标题 封面图片 文章内容 城市 分类 平均评分 评论数量 评论列表 作者信息
@Data
@Schema(description = "文章DTO")
public class PostDTO {
    
    @Schema(description = "文章ID（创建时不需要填写）", accessMode = Schema.AccessMode.READ_ONLY)
    private Long id;
    
    @NotBlank(message = "文章标题不能为空")
    @Schema(description = "文章标题", required = true, example = "上海三日游完全攻略")
    private String title;
    
    @Schema(description = "封面图片", example = "http://pic.maxtral.fun/Onedrive/2024/12/18/cover.jpg")
    private String coverImage;
    
    @NotBlank(message = "文章内容不能为空")
    @Schema(description = "文章内容", required = true, 
           example = "第一天：外滩-豫园\n第二天：东方明珠-科技馆\n第三天：迪士尼乐园")
    private String content;
    
    @NotBlank(message = "城市不能为空")
    @Schema(description = "城市", required = true, example = "上海")
    private String city;
    
    @NotBlank(message = "分类不能为空")
    @Schema(description = "文章分类", required = true, example = "旅游攻略",
           allowableValues = {"旅游攻略", "美食推荐", "景点介绍", "住宿体验"})
    private String category;
    
    @Schema(description = "平均评分（只读）", example = "4.5", 
           accessMode = Schema.AccessMode.READ_ONLY)
    private Double averageRating;
    
    @Schema(description = "评论数量（只读）", example = "10", 
           accessMode = Schema.AccessMode.READ_ONLY)
    private Integer commentCount;
    
    @Schema(description = "评论列表（只读）", accessMode = Schema.AccessMode.READ_ONLY)
    private List<Comment> comments;
    
    @Schema(description = "作者信息（只读）", accessMode = Schema.AccessMode.READ_ONLY)
    private SimpleUserDTO user;
} 